package com.dcw.lixb.designmode.abstract_factory;

import com.dcw.lixb.designmode.R;

/**
 * @author lixiaobin
 * @date 2020-07-16 16:56:09
 * @desc 描述信息
 */
public class ColorFactory implements AbsFactory {

    public static final String RED = "red";
    public static final String YELLOW = "yellow";
    public static final String GREEN = "green";

    @Override
    public Color getColor(String color) {
        switch (color) {
            case RED:
                return new Red();
            case YELLOW:
                return new Yellow();
            case GREEN:
                return new Green();
            default:
                return new Color() {
                    @Override
                    public void fill() {
                        System.out.println("fill unknown color");
                    }
                };
        }
    }

    @Override
    public Shape getShape(String shape) {
        return null;
    }
}
